package com.texaco.chapasFutbol.scene;

import org.andengine.entity.scene.background.SpriteBackground;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.text.AutoWrap;
import org.andengine.entity.text.Text;
import org.andengine.entity.text.TextOptions;
import org.andengine.util.HorizontalAlign;
import org.andengine.util.progress.IProgressListener;

import com.texaco.chapasFutbol.ChapasFutbolActivity;
import com.texaco.chapasFutbol.R;
import com.texaco.chapasFutbol.entidades.Game;
import com.texaco.chapasFutbol.resources.Resources;

/**
 * Clase que implementa la escena de espera del multiplayer.
 * @author texaco
 *
 */
public class WaitMultiplayerScene extends SceneBase{

	public WaitMultiplayerScene(Game game){
			super(game);
	}

	@Override
	public void initAsync(IProgressListener pProgressListener) {
		ChapasFutbolActivity activity = game.getActivity();
		Sprite bgCommon = new Sprite(0, 0, 
				activity.getShapesMaps().get(Game.OPTIONS_BACKGROUND_SHAPE), 
				activity.getVertexBufferObjectManager());
		
		this.setBackground(new SpriteBackground(bgCommon));
		
		Text tWaiting = new Text(activity.getEngine().getCamera().getWidth()/2, activity.getEngine().getCamera().getHeight()/2, 
				activity.getFontMap().get(Resources.FONT_OPTIONS_CAPTION),
				activity.getString(R.string.tMultiPlayerWaitingOponent), 
				activity.getString(R.string.tMultiPlayerWaitingOponent).length(),
				new TextOptions(AutoWrap.NONE, activity.getEngine().getCamera().getWidth() - 200, 
						HorizontalAlign.CENTER, 0),
				activity.getVertexBufferObjectManager());
		
		this.attachChild(tWaiting);
	}

	@Override
	protected void update() {
		// TODO Auto-generated method stub
	}

	@Override
	protected boolean async() {
		return true;
	}
}
